<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // const obj = new Object();

        // 常规写法
        const obj = {
            name: 'why',
            age: 18 ,
            height: 168,
            run: function(){
                console.log("在奔跑");
            },
            eat:function(){
                console.log("在吃饭");
            }
        } 

        // 属性增强写法
        const name = 'obe';
        const age = 18;
        const height = 1.89;

        // ES5 的写法
        const obj1 = {
            name: name,
            age: age,
            height: height
        }
        console.log(obj1);

        // ES6 的写法
        const obj2 = {
            name,
            age,
            height
        }
        console.log(obj2);


        // 函数的增强写法
        // ES5
        const obj3 = {
            run: function(){
                console.log("在奔跑");
            },
            eat:function(){
                console.log("在吃饭");
            }
        } 
        // ES6 的写法
        const obj4 = {
            run() {
                console.log("在奔跑");
            },
            eat() {
                console.log("在吃饭");
            }
        } 


    </script>
</body>
</html>